package cn.iocoder.yudao.module.trade.api.depositProductRelation;

import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.trade.api.depositproductrelation.DepositProductRelationApi;
import cn.iocoder.yudao.module.trade.api.depositproductrelation.dto.DepositProductRelationDTO;
import cn.iocoder.yudao.module.trade.dal.dataobject.depositproductrelation.DepositProductRelationDO;
import cn.iocoder.yudao.module.trade.dal.mysql.depositproductrelation.DepositProductRelationMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 *  押金与钢瓶关系
 */
@Service
public class DepositProductRelationApiImpl implements DepositProductRelationApi {

    @Resource
    private DepositProductRelationMapper depositProductRelationMapper;

    @Override
    public List<DepositProductRelationDTO> selectDepositByDepositId(Long id) {
        LambdaQueryWrapperX<DepositProductRelationDO> relationDOS = new LambdaQueryWrapperX<>();
        relationDOS.eq(DepositProductRelationDO :: getDepositId, id);
        return BeanUtils.toBean(depositProductRelationMapper.selectList(relationDOS), DepositProductRelationDTO.class);
    }

    @Override
    public List<DepositProductRelationDTO> selectDepositProductByDepositId(Long id) {
        return depositProductRelationMapper.selectDepositProductByDepositId(id);
    }
}
